﻿// --------------------------------------------------------------------------------------------------------------------- 
// <copyright file="RedirectPageInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the RedirectPageInfo type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------
namespace Collaboris.Saf.Actions.Moss.Entities
{
    using System;
    using System.Xml.Serialization;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [Serializable]
    [CollaborisClass(Title = "Redirect Page Info", 
        ReleaseStatus = ReleaseStatus.Beta,
        Summary = "Defines the parameters to define a redirect page.")]
    public class RedirectPageInfo : WSSEntityBase
    {
        #region Constants and Fields

        private bool? addVersionIfExists;

        private string customContentTypeId;

        private string customPageLayout;

        private string customUrlDescFieldName;

        private string customUrlFieldName;

        private string pageName;

        private string redirectUrl;

        private string redirectUrlDescription;

        private bool? setAsDefault;

        #endregion

        #region Properties

        [CollaborisProperty(
             Summary = "Specifies whether to create a new version if the page already exists at the destination URL.",
             Title = "Add Version If Exists",
             Required = false,
             Example = "true",
             InputHint = InputHint.NullableBoolean)]
        [XmlElement(IsNullable = true)]
        public bool? AddVersionIfExists
        {
            get
            {
                return this.addVersionIfExists;
            }

            set
            {
                this.addVersionIfExists = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies a custom content type ID to use, if the <b>not</b> using the standard SharePoint redirect page.",
             Title = "Custom Content Type Id",
             Required = false,
             Remarks = "If you do wish to use a custom redirect page layout then the content type needs to be deployed <b>before</b> this action runs.",
             Example = "",
             InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string CustomContentTypeId
        {
            get
            {
                return this.customContentTypeId;
            }

            set
            {
                this.customContentTypeId = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies a custom page layout to use, if the <b>not</b> using the standard SharePoint redirect page.",
             Title = "Custom Page Layout",
             Required = false,
             Remarks = "If you do wish to use a custom redirect page layout then the page layout needs to be deployed <b>before</b> this action runs.",
             Example = "",
             InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string CustomPageLayout
        {
            get
            {
                return this.customPageLayout;
            }

            set
            {
                this.customPageLayout = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies a custom field name description to use, if the <b>not</b> using the standard SharePoint redirect page.",
             Title = "Custom Url Description Field Name",
             Required = false,
             Example = "",
             InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string CustomUrlDescFieldName
        {
            get
            {
                return this.customUrlDescFieldName;
            }

            set
            {
                this.customUrlDescFieldName = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies a custom field name to contain the URL to redirect to, if the <b>not</b> using the standard SharePoint redirect page.",
             Title = "Custom Url Field Name",
             Required = false,
             Example = "",
             InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string CustomUrlFieldName
        {
            get
            {
                return this.customUrlFieldName;
            }

            set
            {
                this.customUrlFieldName = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies the name of the redirect page that will be created in the 'Pages' library.",
             Title = "Page Name",
             Required = true,
             Example = "RedirectPage.aspx",
             InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string PageName
        {
            get
            {
                return this.pageName;
            }

            set
            {
                this.pageName = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies the URL to redirect to.",
             Title = "Redirect Url",
             Required = false,
             Example = "http://www.collaboris.co.uk",
             InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string RedirectUrl
        {
            get
            {
                return this.redirectUrl;
            }

            set
            {
                this.redirectUrl = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies a description for the redirect.",
             Title = "Redirect Url Description",
             Required = false,
             Example = "Collaboris Web Site",
             InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string RedirectUrlDescription
        {
            get
            {
                return this.redirectUrlDescription;
            }

            set
            {
                this.redirectUrlDescription = value;
            }
        }

        [CollaborisProperty(
                    Summary = "Specifies whether to set the page as the default page in the pages library.",
                    Title = "Set As Default",
                    Required = false,
                    Example = "false",
                    InputHint = InputHint.NullableBoolean)]
        [XmlElement(IsNullable = true)]
        public bool? SetAsDefault
        {
            get
            {
                return this.setAsDefault;
            }

            set
            {
                this.setAsDefault = value;
            }
        }

        #endregion
    }
}